package com.kolon.business.mngr.stat.controller;

import java.util.HashMap;
import java.util.List;
import java.util.Map;

import javax.annotation.Resource;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.servlet.ModelAndView;

import com.kolon.business.mngr.stat.dao.StatDao;
import com.kolon.framework.interfaces.SimpleController;
import com.kolon.framework.util.ComUtil;
import com.kolon.framework.util.DateUtil;

/**
 * 서비스 통계
 * @author stone
 */
@Controller("com.kolon.business.mngr.stat.controller.StatMonthController")
public class StatMonthController implements SimpleController {

	@Resource(name="com.kolon.business.mngr.stat.dao.StatDaoImpl")
	private StatDao statDao;
	
	@SuppressWarnings("rawtypes")
	@RequestMapping(value="/business/mngr/stat/statMonth.do")
	public ModelAndView controller(HttpServletRequest request,
			HttpServletResponse response) throws Exception {

		Map<String, String> map = new HashMap<String, String>();
		// 파라미터
		String year = ComUtil.nullChk(request.getParameter("year"), DateUtil.getYearStr());
		map.put("year", year);
		// 목록 조회
		List list = statDao.getList(map);
		// 리턴
		ModelAndView modelAndView = new ModelAndView();
		modelAndView.addObject("list", list);
		modelAndView.addObject("year", year);
		return modelAndView;
	}

}